package com.yuanduan.mplus.view;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.view.View;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;

import com.yuanduan.mplus.R;
import com.yuanduan.mplus.model.entity.PromotionEntity;

/**
 * 推广
 */
public class PromotionActivity extends AppCompatActivity {
    private String url;
    private WebView webView;
    private Toolbar toolbar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_promotion);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        toolbar= (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle("推广");
        toolbar.setNavigationIcon(R.mipmap.back_arrow_black);
        setSupportActionBar(toolbar);
        toolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                PromotionActivity.this.finish();
            }
        });
        if(getIntent().getExtras()!=null){
            url=getIntent().getExtras().getString("url");
        }
        webView= (WebView) findViewById(R.id.promotion_webview);
        WebSettings settings=webView.getSettings();
        settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
        settings.setJavaScriptEnabled(true);
        if(!TextUtils.isEmpty(url)){
            webView.loadUrl(url);
        }
    }

}
